#include <string>
#include <unordered_set>

using namespace std;

class Solution {
public:
    int numJewelsInStones(string jewels, string stones) {
        unordered_set<char> s;

        // 记录所有字符到集合中
        for (auto& c : jewels) {
            s.insert(c);
        }

        int count = 0;

        // 如果在集合中那么进行计数
        for (auto& c : stones) {
            if (s.find(c) != s.end()) {
                count ++;
            }
        }

        return count;
    }
};